<!DOCTYPE HTML>
<html style="background: #f3f3f3">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>签约网</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/lawyer.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/lawyer.js"></script>

    <style type="text/css">
        .release_list ul li{
            background: #ffffff;
        }
        .item_list{}
        .item_list dl {}
        .item_list dl dd{
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-left: 0.3rem;
            height: 0.9rem;
            border-top: 1px #f3f3f3 solid;
        }
        .item_list dl dd input{
            width: 3rem;
            height: 0.6rem;
            font-size: 0.28rem;
            text-align: right;
        }
        .item_list dl dd small{
            color: #999999;
        }


    </style>
</head>
<body style="background: #f3f3f3">
  <div id="secHeader">
    <header class="header">
        <a href="javascript:void(0);" onclick="comeBack()" class="back_btn"><img src="../image/head-fanhui.png" alt=""></a>
        <h2>需求详情</h2>
        <!--<a href="javascript:void(0);" class="search_btn"><img src="../image/search.png" alt=""></a>-->
    </header>
  </div>



<section class="release_contract">
    <div class="release_list">
        <ul>
            <div style="display: none" id="show">
                <li style="border-bottom: 1px #f3f3f3 solid!important;">
                    <div class="release_item">
                        <p>委托报价</p>
                        <div class="txt" id="price">3000.00-5000.00元</div>
                    </div>
                </li>
                <li>
                    <div class="release_item">
                        <p>委托保证金</p>
                        <div class="txt" id="margin">100元</div>
                    </div>
                </li>
                <li style="border-bottom: 1px #f3f3f3 solid!important;">
                    <div class="release_item">
                        <p>委托需求类型</p>
                        <div class="txt" id="xq">普通代理</div>
                    </div>
                </li>
                <li>
                    <div class="release_item">
                        <p>案件类型</p>
                        <div class="txt" id="aj">一般民事</div>
                    </div>
                </li>

            </div>

            <li>
                <div class="main1 box"><!-- 普通代理-->
                    <div class="release_item">
                        <p>订单号</p>
                        <em style="font-size: 0.28rem; color: #666666!important;" id="orderno">5486461654</em>
                    </div>
                    <div class="item_list">
                        <dl>
                            <dd><p>订单类型</p><small style="color: #666666!important;font-size: 0.28rem" id="otype">代写文书1</small></dd>
                            <dd><p>订单状态</p><small style="color: #666666!important;font-size: 0.28rem" id="ostate">已接单</small></dd>
                            <dd><p>下单时间</p><small style="color: #666666!important;font-size: 0.28rem" id="time">2019-02-07 14:53</small></dd>
                            <dd id="atime" style="display: none"><p>预约时间</p><small style="color: #666666!important;font-size: 0.28rem" id="agreetime"></small></dd>
                            <dd id="ajian" style="display: none"><p>案件类型</p><small style="color: #666666!important;font-size: 0.28rem" id="aj1"></small></dd>

                        </dl>
                    </div>
                </div>
            </li>
            <li>
                <div class="release_item" style="display: none;" id="aname">
                    <p>联系人姓名</p>
                    <div class="txt" style="color: #666666!important;font-size: 0.28rem" id="name"></div>
                </div>
                <div class="release_item">
                    <p>联系人电话</p>
                    <div class="txt" style="color: #666666!important;font-size: 0.28rem" id="phone" onclick="call()"></div>
                </div>
            </li>
            <li id="des">
                <div class="release_item">
                    <p>问题概述</p>
                </div>
                <div class="text" style="padding-bottom: 0.3rem;">
                    <p id="content"></p>
                </div>
            </li>
            <li id="progress" style="display: none;">
                <div class="release_item">
                    <p>执行进度</p>
                </div>
                <div class="item_list">
                    <dl id="progressInfo">

                    </dl>
                </div>
                <div class="release_item" id="gc">
                    <p>诉讼结果</p>

                    <select name="progress_result" id="progress_result">
                        <option value="">选择诉讼结果</option>
                        <option value="1">胜诉</option>
                        <option value="2">败诉</option>
                        <option value="3">其他</option>
                    </select>
                </div>
            </li>
        </ul>
    </div>
</section>
</body>
<style type="text/css">
    #progressInfo{}
    #progressInfo dd{color: #999999;}
    #progressInfo dd small{ font-size: 0.28rem;}
    #progressInfo dd.active1{color: #333333;}
    #progressInfo dd.active1 small{color: #333333;}
    #progressInfo dd.active2{color: #333333;}
    #progressInfo dd.active2 small{color: #1c83ea;}
</style>

<script type="text/javascript" src="__JS__/lawyer.js"></script>
<script>
    var para;
    var type;
    var id;
    var progressid='';
    var telephone = '';
    apiready = function () {
      $api.fixStatusBar( $api.dom('#secHeader') );
      api.setStatusBarStyle({
          style: 'light'
      });

        api. addEventListener({name:'scrolltobottom'}, function(ret, err){

        });

        para=api.pageParam;
        type=para.type;
        id=para.id;

        toDoRequest2()
    };

    function call(){
      api.call({
          type: 'tel_prompt',
          number: telephone
      });
    }


    function toDoRequest2(){
        loginCheck()
        var p= {token:token,id:para.id,type:type,infock:2};
        $.post(webSiteUrl+'/app/user/chakan',p,function(ret){
            if(ret.code==200){


                var tj=ret.data;console.log(tj);
               // alert(tj.status);
                if(type==2){
                    $('#price').html(tj.price);
                    $('#margin').html(tj.margin);
                    $('#xq').html(tj.xq);
                    $('#aj').html(tj.aj);
                    $('#show').show()


                }
                if(tj.type==3 || tj.type==4 || tj.type==5){
                    $('#name').html(tj.name);
                    $('#aname').show()

                }
                if(tj.type==3){
                    $('#agreetime').html(tj.agreetime);
                    $('#atime').show()

                    $('#aj1').html(tj.aj);
                    $('#ajian').show()

                    $('#des').hide()

                }

                $('#orderno').html(tj.orderno);
                $('#otype').html(tj.otype);
                $('#ostate').html(tj.ostate);
                $('#time').html(tj.time);
                $('#phone').html(tj.phone);
                telephone = tj.phone;
                $('#content').html(tj.content);

                if((tj.status == 2&&tj.twopay==1)||tj.status == 4){
                   $("#progress").show();
               }
                progressid = tj.progress;

                if(progressid){
                    var p_html = '';
                    if(progressid == 0){
                        p_html ='<dd class="active2"><p>联系客户</p><small onclick="progress(1,0)">确认完成</small></dd>\n' +
                            '<dd ><p>收集资料</p><small>未完成</small></dd>\n' +
                            '<dd><p>委托方案</p><small>未完成</small></dd>\n' +
                            '<dd><p>诉讼过程</p><small>未完成</small></dd>';
                        $("#gc").hide();
                    }else if(progressid == 1){
                        p_html ='<dd class="active1"><p>联系客户</p><small>已完成</small></dd>\n' +
                            '<dd class="active2"><p>收集资料</p><small onclick="progress(2,0)">确认完成</small></dd>\n' +
                            '<dd><p>委托方案</p><small>未完成</small></dd>\n' +
                            '<dd><p>诉讼过程</p><small>未完成</small></dd>';
                        $("#gc").hide();
                    }else if(progressid == 2){
                        p_html ='<dd class="active1"><p>联系客户</p><small>已完成</small></dd>\n' +
                            '<dd class="active1"><p>收集资料</p><small>已完成</small></dd>\n' +
                            '<dd class="active2"><p>委托方案</p><small onclick="progress(3,0)">确认完成</small></dd>\n' +
                            '<dd><p>诉讼过程</p><small>未完成</small></dd>';
                        $("#gc").hide();
                    }else if(progressid == 3){
                        p_html ='<dd class="active1"><p>联系客户</p><small>已完成</small></dd>\n' +
                            '<dd class="active1"><p>收集资料</p><small>已完成</small></dd>\n' +
                            '<dd class="active1"><p>委托方案</p><small>已完成</small></dd>\n' +
                            '<dd class="active2"><p>诉讼过程</p><small onclick="progress(4,0)">确认完成</small></dd>';

                        $("#gc").hide();
                    }else if(progressid == 4){
                        p_html ='<dd class="active1"><p>联系客户</p><small>已完成</small></dd>\n' +
                            '<dd class="active1"><p>收集资料</p><small>已完成</small></dd>\n' +
                            '<dd class="active1"><p>委托方案</p><small>已完成</small></dd>\n' +
                            '<dd class="active1"<p>诉讼过程</p><small>已完成</small></dd>';
                        $("#gc").show();

                    if(tj.progress_result != 0){

                        $("select[name=progress_result]").val(tj.progress_result).attr('disabled','disabled');

                    }else {
                        $("select[name=progress_result]").val(0);
                    }


                    }
                }else {
                    $("#progress").hide();
                }



                $("#progressInfo").html(p_html);
            }else{
                alert(ret.msg)
            }
        });

    }

    function progress(progressid,result){
        if(result == 0){
            var p= {id: id,progress: progressid};
        }else{
            var p= {id: id,progress: progressid,progress_result:result};
        }

        console.log(p)
        $.post(webSiteUrl+'/app/staff/wt_status',p,function(ret){
            console.log(ret)
            if(ret.code==200){
                location.reload();
            }else{
                alert(ret.msg)
            }
        });
    }

    $(function () {
        $(document).on('change','select[name=progress_result]',function () {
            var val = $(this).val();
            progress(4,val)
        })
    })

</script>
</html>
